/*
 *  Copyright (C) 2010 takaji
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package examples;

import dakside.csv.CSVFile;
import dakside.csv.CSVFileWriter;
import java.util.Date;

/**
 * Create in-memory CSV data then write to a file
 * @author takaji
 */
public class ExampleSimple {

    public static void main(String[] args) {
        CSVFile csvData = new CSVFile();
        //add some data
        csvData.newLine().add("Name").add("Salary").add("Birthday"); //line 1
        csvData.newLine().add("Boo").add(4300).add(new Date(86, 4, 23)); //line 2
        csvData.newLine().add("Joe").add(6800.5).add(new Date(84, 9, 27)); //line 3

        //Create a writer to write CSV data
        CSVFileWriter writer = new CSVFileWriter("/home/takaji/employees.csv");

        //Write csvData to file
        writer.writeFile(csvData);

        //Close file (auto save)
        writer.close();
    }
}
